<?php
    @header("Content-Type:text/html;charset=utf-8");    // 配置php文件返回的 文本类型 编码(适应低版本)         => php 向 前端 返回的数据类型

    @include_once("../../php/conn.php");      //引入公共的php

    $ids = $_POST["id"];   // 接收前端传入的id(多个用,分隔)
    $chinese = $_POST["chinese"];  
    $math = $_POST["math"];  
    $english = $_POST["english"];  

    if(!($chinese && $math && $english)) {
        $obj = array();
        $obj["status"] = false;
        $obj["msg"] = "请传入正确参数";
        exit(json_encode($obj));
    }

// 修改

    $update = "update `grade` set chinese = $chinese,math = $math, english = $english where id = $ids ";
    $result = mysqli_query($conn,$update);

    $rows = mysqli_affected_rows($conn);

    $obj = array();
    if($rows > 0) {
        $obj["status"] = true;
        $obj["msg"] = "修改成功";
    }else if ($rows == 0) {
        $obj["status"] = false;
        $obj["msg"] = "数据修改成功,该数据未改变";
    } else {
        $obj["status"] = false;
        $obj["msg"] = "修改失败，请检查sql语句";
        $obj["sql"] = $update;
    }
    echo json_encode($obj);






?>